/**
 * Created by zhangwenlei on 2017/5/1.
 */
ADF.model.NumberModel = function(){
    ADF.model.NumberModel.superclass.constructor.call(this);
};

ADF.model.NumberModel.PROPERTY_ADFPRECISION = "precision";
ADF.model.NumberModel.PROPERTY_ADFICON = "icon";
ADF.model.NumberModel.PROPERTY_QUARTILE = "quartile";

COM.util.defineClass(ADF.model.NumberModel, ADF.model.BaseModel,{

    initModel: function() {
        ADF.model.NumberModel.superclass.initModel.call(this);
        this.addPropertyDescriptor(new ADF.propertyDescriptor.DefaultPropertyDescriptor(ADF.model.NumberModel.PROPERTY_ADFPRECISION, "", "", true, "精度"));
        this.addPropertyDescriptor(new ADF.propertyDescriptor.DefaultPropertyDescriptor(ADF.model.NumberModel.PROPERTY_ADFICON, "", "", true, "符号图标"));
        this.addPropertyDescriptor(new ADF.propertyDescriptor.DefaultPropertyDescriptor(ADF.model.NumberModel.PROPERTY_QUARTILE, "", "", true, "千分位"));
    },
    setADFPrecision: function(precision) {
        this.setPropertyValue(ADF.model.NumberModel.PROPERTY_ADFPRECISION, precision);
    },
    getADFPrecision: function() {
        return this.getPropertyValue(ADF.model.NumberModel.PROPERTY_ADFPRECISION);
    },
    getADFIcon: function() {
        return this.getPropertyValue(ADF.model.NumberModel.PROPERTY_ADFICON);
    },
    setADFIcon: function(icon) {
        this.setPropertyValue(ADF.model.NumberModel.PROPERTY_ADFICON, icon);
    },
    setQuartile:function(quartile){
        this.setPropertyValue(ADF.model.NumberModel.PROPERTY_QUARTILE, quartile);
    },
    getQuartile:function(){
        return this.getPropertyValue(ADF.model.NumberModel.PROPERTY_QUARTILE);
    },
    _getModelType : function(){
        return "ADF.model.NumberModel";
    },
    _getName : function(){
        return 'number';  
    },

    fillSerializedJson : function(jsonObject){
        jsonObject[ADF.model.NumberModel.PROPERTY_ADFPRECISION]=this.getPropertyDescriptor(ADF.model.NumberModel.PROPERTY_ADFPRECISION).serialize();
        jsonObject[ADF.model.NumberModel.PROPERTY_ADFICON]=this.getPropertyDescriptor(ADF.model.NumberModel.PROPERTY_ADFICON).serialize();
        jsonObject[ADF.model.NumberModel.PROPERTY_QUARTILE]=this.getPropertyDescriptor(ADF.model.NumberModel.PROPERTY_QUARTILE).serialize();
    },

    _deserialize:function (jsonObject) {
        var newProp=null;
        newProp=new AGEF.PropertyDescriptor();
        newProp.deserialize(jsonObject[ADF.model.NumberModel.PROPERTY_ADFPRECISION]);
        this.propertyDescriptors.put(newProp.getName(),newProp);

        newProp=new AGEF.PropertyDescriptor();
        newProp.deserialize(jsonObject[ADF.model.NumberModel.PROPERTY_ADFICON]);
        this.propertyDescriptors.put(newProp.getName(),newProp);

        newProp=new AGEF.PropertyDescriptor();
        newProp.deserialize(jsonObject[ADF.model.NumberModel.PROPERTY_QUARTILE]);
        this.propertyDescriptors.put(newProp.getName(),newProp);
    }
});